﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace System
{
    public static class DateTimeExtention
    {
        /// <summary>
        /// 获取时间戳
        /// </summary>
        /// <param name="time"></param>
        /// <param name="isUniversal">是否以世界时间为准</param>
        /// <returns></returns>
        public static int GetTimestamp(this DateTime time, bool isUniversal = false)
        {
            if (isUniversal)
                return (int)(time.ToUniversalTime() - OriginalTime).TotalSeconds;
            else
                return (int)(time - OriginalTime).TotalSeconds;
        }

        ///// <summary>
        ///// 获取农历时间结构
        ///// </summary>
        ///// <param name="time"></param>
        ///// <returns></returns>
        //public static Lunar GetLunarData(this DateTime time)
        //{
        //    return LunarAPI.GetLunarDate(time);
        //}


        private static readonly DateTime OriginalTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);

    }
}

